package;


import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;
import flixel.util.FlxColor;
import flixel.addons.text.FlxTypeText;
import flixel.util.FlxRandom;

/**
 * A FlxState which can be used for the game's menu.
 */
class AntesMejorState extends PreguntaState
{
	private var scoreFloat:Float;
	/**
	 * Function that is called up when to state is created to set it up. 
	 */
	
	override public function create():Void
	{
		super.create();
		var delay:Float = 20 / pregLength;
		trace(delay);
		_pregunta.start(delay, true);
		scoreFloat = 20;
	}
	
	override function update():Void
	{
		super.update();		
		switch(estado)
		{
			case "esperando":
				if (player1.getInput() == -1)
					score1 = Std.int(scoreFloat);
				if (player2.getInput() == -1)
					score2 = Std.int(scoreFloat);
				if (player3.getInput() == -1)
					score3 = Std.int(scoreFloat);
				if (player4.getInput() == -1)
					score4 = Std.int(scoreFloat);
				if (_reloj > 10)
				{
					scoreFloat -= FlxG.elapsed / 2;
				}
				else
					scoreFloat = 10;
				
		}
	}

}